package xupt.se.ttms.service;

import java.sql.ResultSet;
import java.util.List;

import xupt.se.ttms.idao.DAOFactory;
import xupt.se.ttms.idao.iCustomerDAO;
import xupt.se.ttms.model.Customer;

public class CustomerSrv {
	private iCustomerDAO customerDAO=DAOFactory.creatCustomerDAO();
	public boolean add(Customer customer) throws Exception{
		
		return customerDAO.execInsert(customer);
	}
	
	public boolean modify(Customer customer) throws Exception{
		return customerDAO.execUpdate(customer); 		
	}
	
	public boolean delete(int ID) throws Exception{
		return customerDAO.execDelete(ID);		
	}
	
	public List<Customer> Fetch(String condt) throws Exception{
		ResultSet resultSet=customerDAO.execQuery(condt);	
		return customerDAO.HandleCustomerResultSet(resultSet);	
	}
	public List<Customer> FetchNormal(String level) throws Exception{
		ResultSet resultSet=customerDAO.execQueryNormal(level);
		return customerDAO.HandleCustomerResultSet(resultSet);	
	}
	public List<Customer> FetchVip(String level) throws Exception{
		ResultSet resultSet=customerDAO.execQueryVip(level);
		return customerDAO.HandleCustomerResultSet(resultSet);	
	}
	public List<Customer> FetchAll() throws Exception{
		ResultSet resultSet=customerDAO.exexQueryAll();
		return customerDAO.HandleCustomerResultSet(resultSet);			
	}
}
